define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'weixin.user/index',
        add_url: 'weixin.user/add',
        edit_url: 'weixin.user/edit',
        delete_url: 'weixin.user/delete',
        export_url: 'weixin.user/export',
        modify_url: 'weixin.user/modify',
        send_url: 'weixin.user/send',
        push_url: 'weixin.user/push',
        
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh','delete', 'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'openid', title: '用户识别号',width:220},
                    {field: 'type', search: 'select', selectList: ["小程序","微信公众号"], title: '用户类型',width:100},
                    {field: 'nickName', title: '用户昵称',width:120},
                    // {field: 'realname', title: '真实姓名',width:100},
                    {field: 'mobile', title: '手机号',width:190},
                    {field: 'get_integer', title: '剩余积分',width:120,search: false},
                    {field: 'get_express', title: '剩余快递',width:120,search: false},
                    {field: 'avatarUrl', title: '用户头像', templet: ea.table.image},
                    {field: 'create_time', title: '创建时间',width:180},
                    {width: 240, title: '操作', templet: ea.table.tool,operat: [[{
                            text: '赠送积分',
                            extra:'name',
                            url: init.send_url,
                            method: 'open',
                            auth: 'send',
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            extend: 'data-full="true"',
                        },{
                            text: '赠送快递次数',
                            extra:'name',
                            url: init.push_url,
                            method: 'open',
                            auth: 'push',
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            extend: 'data-full="true"',
                        }],'delete']},
                ]],

            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        send: function () {
            ea.listen();
        },
        push: function () {
            ea.listen();
        },
    };
    return Controller;
});